﻿// -----------------------------------------------------------------------
// <copyright file="IPushStatsRepository.cs" company="Zen Design Corp">
// TODO: Update copyright text.
// </copyright>
// -----------------------------------------------------------------------

namespace Zen.BlackBerry.Push.Stats
{
	using System;
	using System.Collections.Generic;
	using System.Linq;
	using System.Text;

	/// <summary>
	/// Interface defining data access methods needed to manage push statistics
	/// in the persistent store. 
	/// </summary>
	public interface IPushStatsRepository
	{
		/// <summary>
		/// Adds push statistics for the push application with the specified id
		/// and provided running push count, running content sum, and daily push
		/// count.
		/// </summary>
		/// <param name="pushStats">The push stats.</param>
		void AddPushStats(PushStats pushStats);

		/// <summary>
		/// Performs a batch update of push statistics for various push
		/// applications.
		/// </summary>
		/// <param name="pushStats">The push stats.</param>
		/// <returns></returns>
		void BatchUpdatePushStats(ICollection<PushStats> pushStats);

		/// <summary>
		/// Gets push statistics for the specified push application.
		/// </summary>
		/// <param name="pushApplicationId">The push application id.</param>
		/// <param name="preferUseCache">if set to <c>true</c> [prefer use cache].</param>
		/// <returns></returns>
		PushStats GetPushStats(string pushApplicationId, bool preferUseCache);

		/// <summary>
		/// Resets the running content sum pushed to the specified push
		/// application.
		/// </summary>
		/// <param name="pushApplicationId">The push application id.</param>
		void ResetRunningContentSum(string pushApplicationId);

		/// <summary>
		/// Resets the running push count for the specified push application.
		/// </summary>
		/// <param name="pushApplicationId">The push application id.</param>
		void ResetRunningPushCount(string pushApplicationId);

		/// <summary>
		/// Updates the cache with the given push stats.
		/// </summary>
		/// <param name="pushStats">The push stats.</param>
		void UpdateCache(PushStats pushStats);

		/// <summary>
		/// Updates push statistics for the specified push application.
		/// </summary>
		/// <param name="pushStats">The push stats.</param>
		/// <returns></returns>
		bool UpdatePushStats(PushStats pushStats);
	}
}
